package com.wangbo.suzhengtong;

import cn.hutool.core.io.FileUtil;
import java.io.File;
import java.io.IOException;

public class TestSZTUtil {

    public static void main(String[] args) throws IOException {
        test02();
    }

    /**
     * 实人认证
     */
    public static void test01() throws IOException {
        String appId = "8370715552875732nk3mkf";
        String username = "szlx";
        String password = "qwer1234";
        String pubKey = "04C4A1624DDB98982F5907D0D06EF9312B9DD350875CA0DBF0E64C1B3C7DDBC1399C822FA23CA81AB2D09F6ECEAEE74D5C1350211B2226349287EBBE25A27FE2BB";
        String personalIdNo = "340181201112124511";
        String name = "朱志勇";
        byte[] bytes = FileUtil.readBytes(new File("D:\\temp\\11971.jpg"));

        String token = SZTUtil.refreshToken(pubKey, username, password, appId);
        SZTUtil.checkPhoto(token, bytes, personalIdNo, name, appId, pubKey);

        // {result_code=0, result_msg=认证成功}
    }

    /**
     * 实名认证
     */
    public static void test02() throws IOException {
        String appId = "708170769458814603ap3h";
        String username = "szlx";
        String password = "qwer1234";
        String pubKey = "04B553533966DA8659995C4C084DAED1F821B83B0950062EF112789C1457FB32DCCD1DC3E283B2F5683B33E37123A938D85E45693603C883C0E1511A8CE1C05B5A";
        String personalIdNo = "152801199010108556";
        String name = "王波111";

        String token = SZTUtil.refreshToken(pubKey, username, password, appId);
        boolean b = SZTUtil.checkId(token, pubKey, appId, personalIdNo, name);
    }


}
